﻿@using Backend.JYD.Common
@{
    int pageIndex = NumberHelper.ObjectToInt(ViewBag.PageIndex);
    int pageSize = NumberHelper.ObjectToInt(ViewBag.PageSize);
    int pageCount = NumberHelper.ObjectToInt(ViewBag.PageCount);
    int itemCount = NumberHelper.ObjectToInt(ViewBag.ItemCount);
}
<div class="page-info">
    <div class="fl page-info-left">共有<strong> @itemCount </strong> 条记录，当前第<strong> @pageIndex </strong> 页，共 <strong> @pageCount </strong> 页</div>
    <div class="page">
        
        @{
            if (pageCount > 1)
            {
        <a href="@(string.Format(ViewBag.PageUrl, 1))">首页</a>
        <a href="@(string.Format(ViewBag.PageUrl, (pageIndex - 1)))">上一页</a>
            }
            if (pageIndex > 5)
            { 
        <a href="@(string.Format(ViewBag.PageUrl, (pageIndex - 5)))">...</a>
            }
            for (int idx = pageIndex - 4; idx >= 1 && idx <= pageIndex + 4 && idx < pageCount; idx++)
            {
                if (pageIndex == idx)
                { 
        <span class="active">@idx</span>
                }
                else
                { 
        <a href="@(string.Format(ViewBag.PageUrl, idx))">@idx</a>
                }
            }
            if (pageCount > pageIndex + 5)
            { 
        <a href="@(string.Format(ViewBag.PageUrl, (pageIndex + 5)))">...</a>
            }
            if (pageCount > 1)
            {
        <a href="@(string.Format(ViewBag.PageUrl, (pageIndex + 1)))">下一页</a>
        <a href="@(string.Format(ViewBag.PageUrl, pageCount))">末页</a>
            }
        }
    </div>
</div>